cmake_minimum_required(VERSION 3.10)
project(MyProject)

# 收集源文件
message("当前源目录: "${CMAKE_CURRENT_SOURCE_DIR})
# aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC)
file(GLOB SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)

# 收集头文件（可选，主要用于IDE显示）
message("工程源目录: "${PROJECT_SOURCE_DIR})
#include_directories(${PROJECT_SOURCE_DIR}/include)
file(GLOB HEADERS ${PROJECT_SOURCE_DIR}/include/*.h)

# 创建可执行文件
message("工程名: "${PROJECT_NAME})
add_executable(${PROJECT_NAME} ${SRC} ${HEADERS})

# 设置包含目录（现代写法，更推荐）
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)

#add_definitions(-D DEBUG)
message(1. ${PROJECT_SOURCE_DIR})
message(2. ${PROJECT_BINARY_DIR})
message(3. ${CMAKE_CURRENT_SOURCE_DIR})
message(4. ${CMAKE_CURRENT_BINARY_DIR})
message(5. ${EXECUTABLE_OUTPUT_PATH})
message(6. ${LIBRARY_OUTPUT_PATH})
message(7. ${PROJECT_NAME})
message(8. ${CMAKE_BINARY_DIR})
